package com.ymatou.iapi.productmanager.testcase;

import com.ymatou.iapi.productmanager.parameter.*;
import com.ymatou.iapi.productmanager.parameter.product.AddSellerProductRequest;
import com.ymatou.iapi.productmanager.service.PreGrouponProductListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.ProductManagerCallServiceV2;
import com.ymttest.business.service.ProductManagerCallServiceV3;
import com.ymttest.database.model.GrouponProducts;
import com.ymttest.database.model.YmtCatalogsI;
import com.ymttest.database.model.YmtProductsI;
import com.ymttest.database.sqlwapper.YmtCatalogsIWapper;
import com.ymttest.database.sqlwapper.YmtProductsIWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
import org.junit.*;
import org.junit.experimental.categories.Category;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
*可选商品列表
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_PreGrouponProductList{
	private static PreGrouponProductListBean pregrouponproductlistBean;
	private static PreGrouponProductListCall pregrouponproductlistCall;
	/**
	 * 优选
	 */
	private static Integer sellerId = 3383;
	/**
	 * 非优选
	 */
	private static Integer sellerId2 = Integer.valueOf(EnvSetup.getData("autotest_seller1"));
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("可选商品列表");
	}

	@Before
	public void caseUp() {
		pregrouponproductlistBean=new PreGrouponProductListBean();
		pregrouponproductlistCall=new PreGrouponProductListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(pregrouponproductlistCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	private void setStock(AddSellerProductRequest addpro, Integer catalogNum) {
		addpro.getProduct().getCatalogList().forEach(catalog -> {
			catalog.setStock(catalogNum);
		});
	}

	private void setPrice(AddSellerProductRequest addpro, Double price) {
		addpro.getProduct().getCatalogList().forEach(catalog -> {
			catalog.setNewPrice(price);
			catalog.setMarketPrice(price);
			catalog.setVipPrice(price);
			catalog.setPrice(price);
		});
	}

	public void checkPreGrouponProductList(PreGrouponProductListBean pregrouponproductlistBean) throws Exception {
		YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
		YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();

		List<SelelctionGrouponProductListDto> selelctionGrouponProductListDtos = pregrouponproductlistCall.getProductList();
		if (selelctionGrouponProductListDtos!=null){
			for(int i=0;i<selelctionGrouponProductListDtos.size();i++){
				String productId = selelctionGrouponProductListDtos.get(i).getProductId();
				YmtProductsI ymtProductsI = ymtProductsIWapper.selectProductByProductId(productId).get(0);
				List<YmtCatalogsI> catalogsIS = ymtCatalogsIWapper.selectCatalogsByProductId(productId);
				Integer totalStock = 0;
				for (YmtCatalogsI p:catalogsIS
					 ) {
					totalStock = totalStock+p.getiNum();
				}
				Logger.verifyEquals(productId,ymtProductsI.getsProductId(),"验证productId");
				Logger.verifyEquals(selelctionGrouponProductListDtos.get(i).getProductName(),ymtProductsI.getsProduct(),"验证productName");
				Logger.verifyEquals(selelctionGrouponProductListDtos.get(i).getThirdCategoryId(),ymtProductsI.getiThirdCategoryId(),"验证ThirdCategoryId");
				Logger.verifyEquals(selelctionGrouponProductListDtos.get(i).getBrandId(),ymtProductsI.getiBrandId(),"验证BrandId");
				Logger.verifyEquals(selelctionGrouponProductListDtos.get(i).getMainPicUrl(),ymtProductsI.getsPicUrl(),"验证MainPicUrl");
				Logger.verifyEquals(selelctionGrouponProductListDtos.get(i).getCatalogStatus(),ymtProductsI.getiCatalogStatus(),"验证CatalogStatus");
				Logger.verifyEquals(selelctionGrouponProductListDtos.get(i).getProductStock(),totalStock,"验证ProductStock");
				if(ymtProductsI.getValidStart().getTime() < System.currentTimeMillis() && ymtProductsI.getValidEnd().getTime() > System.currentTimeMillis()){
					Logger.verifyEquals(selelctionGrouponProductListDtos.get(i).getStatusList().get(0),1,"验证StatusList");
				}else{
					Logger.verifyEquals(selelctionGrouponProductListDtos.get(i).getStatusList().get(0),2,"验证StatusList");

				}
				Logger.verifyEquals(selelctionGrouponProductListDtos.get(i).getMinGrouponStock(),20,"验证MinGrouponStock");


				List<YmtCatalogsI> ymtCatalogsIS = new YmtCatalogsIWapper().selectCatalogsByProductId(productId);
				Logger.debug("productId:"+productId);
				double MinCatalogPrice = Collections.min(ymtCatalogsIS.stream().filter(c->c.getiAction()==0).map(c -> c.getfQuotePrice()).collect(Collectors.toList())).doubleValue();
				double MaxCatalogPrice = Collections.max(ymtCatalogsIS.stream().filter(c->c.getiAction()==0).map(c -> c.getfQuotePrice()).collect(Collectors.toList())).doubleValue();
				Logger.verifyEquals(selelctionGrouponProductListDtos.get(i).getMaxCatalogPrice(),MaxCatalogPrice,"验证MaxCatalogPrice");
				Logger.verifyEquals(selelctionGrouponProductListDtos.get(i).getMinCatalogPrice(),MinCatalogPrice,"验证MaxCatalogPrice");

				String ResonList = "下架商品，总库存低于20件，商品价格超过300元，商品已参与其他拼团，此商品类目不支持拼团";
				if (pregrouponproductlistBean.getTab()==0?true:false){
					Logger.verifyEquals(1003,selelctionGrouponProductListDtos.get(i).getThirdCategoryId(),"验证ThirdCategoryId");
					Logger.verifyEquals(true,selelctionGrouponProductListDtos.get(i).getProductStock()>=20?true:false,"验证商品库存大于20");
					Logger.verifyEquals(true,selelctionGrouponProductListDtos.get(i).getMaxCatalogPrice()<=300?true:false,"验证商品价格小于300");
					Logger.verifyEquals(selelctionGrouponProductListDtos.get(i).getResonList(),new ArrayList<>(),"验证ResonList");
					if (pregrouponproductlistBean.getProductName()!=null){
						Logger.verifyEquals(true,selelctionGrouponProductListDtos.get(i).getProductName().contains(pregrouponproductlistBean.getProductName()),"验证ProductName");
					}
					if (pregrouponproductlistBean.getThirdCategoryId()!=0){
						Logger.verifyEquals(1003,selelctionGrouponProductListDtos.get(i).getThirdCategoryId(),"验证ThirdCategoryId");
					}
				}else{
					selelctionGrouponProductListDtos.get(i).getResonList().forEach(p->{
						Logger.verifyEquals(true,ResonList.contains(p),"验证ResonList");
					});
				}
			}
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_01() {
		Logger.start(true,"买手获取可选商品列表，成功");
		try {
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(10);
			//0是可选，1是不可选
			pregrouponproductlistBean.setTab(0);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_09() {
		Logger.start(true,"买手获取可选商品列表，根据商品名称模糊查询，成功");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setProductName("拼团"+TestDataManager.getRandomNum(5));
			ProductManagerCallServiceV3.AddSellerProduct(addpro);

			pregrouponproductlistBean.setProductName("拼团");
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(1);
			//0是可选，1是不可选
			pregrouponproductlistBean.setTab(0);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_02() {
		Logger.start(true,"买手获取不可选商品列表，总库存小于20，成功");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setProductName("拼团"+ TestDataManager.getRandomNum(6));
			setStock(addpro, 9);
			setPrice(addpro, 100d);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);

			Thread.sleep(5000);
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(1);
			pregrouponproductlistBean.setTab(1);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();			
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_03() {
		Logger.start(true,"买手获取不可选商品列表，商品价格高于300，成功");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setProductName("拼团"+ TestDataManager.getRandomNum(6));
			setStock(addpro, 20);
			setPrice(addpro, 301d);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);

			Thread.sleep(5000);
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(1);
			pregrouponproductlistBean.setTab(1);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_06() {
		Logger.start(true,"买手获取不可选商品列表，商品已参与其他拼团，成功");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setProductName("拼团"+ TestDataManager.getRandomNum(6));
			setStock(addpro, 20);
			setPrice(addpro, 220d);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			//创建拼团
			SaveGrouponBean saveGrouponBean = ProductManagerCallServiceV3.initSaveGrouponBean(sellerId,productId,100d);
			ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(1);
			pregrouponproductlistBean.setTab(1);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_05() {
		Logger.start(true,"买手获取不可选商品列表，下架商品，成功");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setProductName("拼团"+ TestDataManager.getRandomNum(6));
			setStock(addpro, 20);
			setPrice(addpro, 220d);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			ProductManagerCallServiceV2.batchSetProductOffSale(Arrays.asList(productId),sellerId);

			Thread.sleep(5000);
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(1);
			pregrouponproductlistBean.setTab(1);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	//不作校验
	public void Tc_PreGrouponProductList_04() {
		Logger.start(true,"sellerId为空，获取失败");
		try {
//			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(1);
			pregrouponproductlistBean.setTab(1);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_07() {
		Logger.start(true,"买手获取不可选商品列表，上架商品的三级类目不为1003，获取成功");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setThirdCategoryId(1004);
			addpro.getProduct().setProductName("拼团"+ TestDataManager.getRandomNum(6));
			setStock(addpro, 20);
			setPrice(addpro, 220d);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);

			Thread.sleep(2000);
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(1);
			pregrouponproductlistBean.setTab(1);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_08() {
		Logger.start(true,"买手获取不可选商品列表，商品的价格大于300，库存小于20，三级类目不为1003，获取成功");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setThirdCategoryId(1004);
			addpro.getProduct().setProductName("拼团"+ TestDataManager.getRandomNum(6));
			setStock(addpro, 9);
			setPrice(addpro, 301d);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			Thread.sleep(2000);
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(1);
			pregrouponproductlistBean.setTab(1);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	//不做校验
	public void Tc_PreGrouponProductList_10() {
		Logger.start(true,"不是优选买手获取可选商品列表");
		try {
			pregrouponproductlistBean.setSellerId(sellerId2);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(1);
			pregrouponproductlistBean.setTab(1);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_PreGrouponProductList_11() {
        Logger.start(true,"买手获取可选商品列表，商品总库存大于20");
        try {
            pregrouponproductlistBean.setSellerId(sellerId);
            pregrouponproductlistBean.setPageIndex(1);
            pregrouponproductlistBean.setPageSize(10);
            pregrouponproductlistBean.setTab(0);
            pregrouponproductlistCall.setData(pregrouponproductlistBean);
            pregrouponproductlistCall.callService();
            Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);

		} catch (Exception e) {
            Logger.fail(e);
        }
    }

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_12() {
		Logger.start(true,"买手获取可选商品列表，商品总库存大于20");
		try {
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(10);
			pregrouponproductlistBean.setTab(0);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_13() {
		Logger.start(true,"买手获取可选商品列表，商品都为上架状态");
		try {
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(10);
			pregrouponproductlistBean.setTab(0);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_14() {
		Logger.start(true,"买手获取可选商品列表，商品类目都为指定类目");
		try {
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(10);
			pregrouponproductlistBean.setTab(0);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_15() {
		Logger.start(true,"买手获取可选商品列表，商品价格都小于300");
		try {
			pregrouponproductlistBean.setSellerId(3383);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(10);
			pregrouponproductlistBean.setTab(0);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_16() {
		Logger.start(true,"买手获取不可选商品列表，根据商品名称来获取");
		try {
			pregrouponproductlistBean.setProductName("测试");
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(1);
			//0是可选，1是不可选
			pregrouponproductlistBean.setTab(1);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_17() {
		Logger.start(true,"买手获取不可选商品列表，根据商品名称来获取");
		try {
			pregrouponproductlistBean.setProductName("测试");
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(1);
			//0是可选，1是不可选
			pregrouponproductlistBean.setTab(1);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			Logger.verifyEquals("200",pregrouponproductlistCall.getString("Code"),"验证Code");
			checkPreGrouponProductList(pregrouponproductlistBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_PreGrouponProductList_18() {
		Logger.start(true,"买手创建拼团商品，在拼团商品列表中可见，在可选拼团商品列表中不可见");
		try {
			//创建商品
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			setStock(addpro, 30);
			setPrice(addpro, 100d);
			String pid = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Thread.sleep(2000);
			//买手获取可选拼团商品列表
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(1);
			//0是可选，1是不可选
			pregrouponproductlistBean.setTab(0);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			List<SelelctionGrouponProductListDto> selelctionGrouponProductListDtos = pregrouponproductlistCall.getProductList();
			List<String> productList = selelctionGrouponProductListDtos.stream().map(x->x.getProductId()).collect(Collectors.toList());
			Logger.debug("productList:"+productList);
			Logger.verifyEquals(true,productList.toString().contains(pid),"验证买手可选拼团商品列表含有刚刚创建的商品");

			//创建拼团商品
			SaveGrouponBean saveGrouponBean = ProductManagerCallServiceV3.initSaveGrouponBean(sellerId,pid,50d);
			ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			List<GrouponProducts> gp = ymtProductsIWapper.selectGrouponProducts(pid, null, 0);

			//获取买手拼团商品
			Thread.sleep(2000);
			GrouponProductListBean grouponProductListBean = ProductManagerCallServiceV3.initGrouponProductList(sellerId);
			List<GrouponProductListDto> grouponProductListDtos = ProductManagerCallServiceV3.GetGrouponProductList(grouponProductListBean).getProductList();
			List<String> pids = grouponProductListDtos.stream().map(x->x.getProductId()).collect(Collectors.toList());
			Logger.debug("pid:"+pids);
			Logger.verifyEquals(true,pids.toString().contains(pid),"验证买手拼团商品列表中含有刚刚创建的拼团商品");

			Thread.sleep(2000);
			//买手获取不可选拼团商品列表
			pregrouponproductlistBean.setSellerId(sellerId);
			pregrouponproductlistBean.setPageIndex(1);
			pregrouponproductlistBean.setPageSize(1);
			//0是可选，1是不可选
			pregrouponproductlistBean.setTab(1);
			pregrouponproductlistCall.setData(pregrouponproductlistBean);
			pregrouponproductlistCall.callService();
			List<SelelctionGrouponProductListDto> selelctionGrouponProductListDtos1 = pregrouponproductlistCall.getProductList();
			List<String> productList1 = selelctionGrouponProductListDtos1.stream().map(x->x.getProductId()).collect(Collectors.toList());
			Logger.verifyEquals(true,productList1.toString().contains(pid),"验证买手不可选拼团商品列表含有刚刚创建的拼团商品");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

}